<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>修改密码————鑫四合珠宝管理后台</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="huyuzhu">
<!-- Le styles -->
<link href="${pageContext.request.contextPath}/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="${pageContext.request.contextPath}/css/base.css" rel="stylesheet">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap-affix.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.placeholder.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap-modal.js"></script>
<script type="text/javascript">

<s:if test="message!=null">
$(document).ready(function(){
	$("#myModal").modal('show');
});
</s:if>

function modify(pageIndex){
	clear();
	var oldPw = $("#oldPasswd").val();
	oldPw = $.trim(oldPw);
	if(oldPw == ""){
		$("#oldMsg").html("原密码不能为空!");
		return false;
	}
	if(oldPw.length<3){
		$("#oldMsg").html("原密码长度过小!");
		return false;
	}
	
	var newPw = $("#newPasswd").val();
	newPw = $.trim(newPw);
	if(newPw == ""){
		$("#newMsg").html("新密码不能为空!");
		return false;
	}
	if(newPw.length<3){
		$("#newMsg").html("新密码长度过小!");
		return false;
	}
	var newPw2 = $("#newPasswd2").val();
	newPw2 = $.trim(newPw2);
	if(newPw2!=newPw){
		$("#newMsg2").html("两次输入新密码不一致!");
		return false;
	}
	$("#passwdForm").submit();
}

function clear(){
	$("#oldMsg").html("");
	$("#newMsg").html("");
	$("#newMsg2").html("");
	$("#message").html("");
}
</script>
</head>
<body>
<!-- 头部 -->
<s:include value="header.jsp"/>
<!-- 修改密码开始 -->
<div class="conBox passwordBox">
<h3 class="titleBox">修改密码</h3>
<s:form id="passwdForm" action="doModifyPasswd" cssClass="form-horizontal">
  <div class="control-group">
    <label class="control-label" for="oldPassword">旧密码：</label>
    <div class="controls">
      <s:password name="user.passwd" id="oldPasswd"  placeholder="请输入原密码"/>
      <span id="oldMsg" class="help-inline"></span> </div>
  </div>
  <div class="control-group">
    <label class="control-label" for="inputPassword">密码：</label>
    <div class="controls">
      <s:password name="user.newPasswd"  id="newPasswd"  placeholder="请输入新密码"/>
      <span id="newMsg" class="help-inline"></span> </div>
  </div>
  <div class="control-group">
    <label class="control-label" for="confirmPassword">确认密码：</label>
    <div class="controls">
     <s:password name="user.newPasswd2"  id="newPasswd2" placeholder="请确认密码"/>
      <span id="newMsg2" class="help-inline"></span>
    </div>
  </div>
  <div class="control-group">
    <div class="controls">
      <input type="button" class="btn btn-primary" onclick="modify()" value="确定">
      <s:reset cssClass="btn" value="重置"/>
      <s:if test="#session.UserInfo.userVO.userType==1">
      	<s:a cssClass="btn" action="adminHome" namespace="a">返回</s:a>
      </s:if>
      <s:if test="#session.UserInfo.userVO.userType==2">
      	<s:a cssClass="btn" action="adminHome" namespace="a">返回</s:a>
      </s:if>
      <s:if test="#session.UserInfo.userVO.userType==3">
      	<s:a cssClass="btn" action="adminHome" namespace="a">返回</s:a>
      </s:if>
    </div>
  </div>
</s:form>
<!-- 修改密码结束 --> 
</div>
<!-- 尾部 --> 
<s:include value="bottom.jsp"/>

<div class="modal hide fade" id="myModal">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>操作提示</h3>
  </div>
  <div class="modal-body">
    <p><s:property  value="message"/></p>
  </div>
  <div class="modal-footer">
    <a href="#" class="btn btn-primary" data-dismiss="modal">确定</a>
  </div>
</div>

</body>
</html>